package com.company;

import java.util.List;

/**
 * Created by v on 17-7-9.
 * 子弹类
 */
public class Bullet extends Flyer{
    private static int speed=3;

    public Bullet(int x,int y){
        this.x=x;
        this.y=y;
        this.setImage(Image.bullet);
        this.width=image.getWidth();
        this.height=image.getHeight();
    }

    @Override
    public boolean outOfBound() {
        return y<-height;
    }

    @Override
    public void step() {
        y-=speed;
    }


    public int boom(List<Flyer> list){
        for(int i=0;i<list.size();i++){
            if(list.get(i).bulletCollision(this)){
                return i;
            }
        }

        return -1;
    }
}
